<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/vue.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div id="app">
    <span>
        <button @click="left">👈</button>
        <img :src="images[currentIndex].src" alt="">
        <button @click="right">👉</button>
    </span>
    <div>{{currentIndex}}</div>
</div>
</body>
</html>
<script>
    new Vue({
        el: '#app',
        data: {
            images:[
                {id:1,src:'../img/c.png'},
                {id:2,src:'../img/htmlcss.png'},
                {id:3,src:'../img/htmlcss200.png'},
                {id:4,src:'../img/java200.png'},
                {id:5,src:'../img/javascript.png'},
            ],
            currentIndex:2
        },
        methods: {
            left(){
                this.currentIndex--
                if (this.currentIndex <0){
                    this.currentIndex=4
                }
            },
            right(){
                this.currentIndex++
                if (this.currentIndex >4){
                    this.currentIndex=0
                }

            }
        }
    })
</script>
